<template>
  <div>

    <div class="title">

      <input id="myInput" v-model="inputVal" disabled type="text" @input="showList">

      <span class="right"> <i class="el-icon-caret-bottom" @click="isShow" /></span>
      <div v-if="showDropdown" class="box">
        <ul id="myList" @click="selectOption">
          <li v-for="item in options" :key="item">{{ item }}</li>
        </ul>
      </div>
    </div>

  </div>

</template>

<script>
export default {
  name: 'AttendancesIndex',
  data() {
    return {
      inputVal: '',
      showDropdown: false,
      options: ['本年', '本月', '本周', '今日']
    }
  },
  methods: {
    showList() {
      this.showDropdown = true
    },
    isShow() {
      this.showDropdown = true
    },
    selectOption(evt) {
      this.inputVal = evt.target.innerHTML
      this.showDropdown = false
    }
  }
}
</script>

<style lang="scss" scoped>
#myInput {
  width:66px;
  height: 18px;
  margin-left: 100px;
  margin-top: 30px;
  font-size: 12px;
    font-weight: 700;
    text-align: center;
    padding-right: 13px;
  /* padding:10px; */
  border:1px solid #ccc;
}
#myList {
  list-style-type:none;
  padding:0;
  margin:0;
  display:block;
  height: 68px;
  overflow :auto

}

#myList li:nth-child(1){
  padding: 0;
}
#myList li {
  /* padding:8px 4px; */
  width: 100%;
  height: 23px;
  text-align: center;
  line-height: 23px;
  font-size: 12px;
  color: #666666;
  cursor:pointer;
  /* background:#eee; */
  /* border-bottom:1px solid #ccc; */
}
#myList li:hover {
  background:#ccc;
  font-weight: 700;
  color: #3333;
}
.title{
  position: absolute;
}
.right{
  position: relative;
  right: 16px;
  color: #ffff;
  background-color:green;
}
.box{
  width: 66px;
  height: 68px;
  /* background-color: pink; */
  border: 1px solid #cccc;
   margin-left: 100px;
  /* margin-top: 30px */
}
</style>

